package com.kx.kxpicture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kx.kxpicture.model.dto.user.UserQueryRequestDTO;
import com.kx.kxpicture.model.dto.user.UserRegisterDTO;
import com.kx.kxpicture.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kx.kxpicture.model.vo.UserLoginVO;
import com.kx.kxpicture.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author kuang
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-08-14 17:29:32
*/
public interface UserService extends IService<User> {
    /**
     * 用户注册
     *
     * @param userRegisterDTO 注册信息
     * @return id
     * @author kuangxin
     * @date 2025/8/15
     */
    public Long userRegister(UserRegisterDTO userRegisterDTO);

    /**
     * 用户登录
     *
     * @param userAccount 账号
     * @param password    密码
     * @param request     请求
     * @return UserLoginVO
     */
    public UserLoginVO userLogin(String userAccount, String password, HttpServletRequest request);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return user
     */
    public User getLoginUser(HttpServletRequest request);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    public boolean userLogout(HttpServletRequest request);

    /**
     * 加密密码
     *
     * @param userPassword 密码
     * @return 加密后的密码
     */
    public String getEncryptPassword(String userPassword);

    /**
     * user转换vo
     *
     * @param user
     * @return
     */
    public UserVO getUserToVo(User user);

    /**
     * user列表转换
     *
     * @param users
     * @return
     */
    public List<UserVO> getUserVOList(List<User> users);

    /**
     * 查询类转换wrapper
     *
     * @param userQueryRequestDTO
     * @return
     */
    public QueryWrapper<User> getQueryWrapper(UserQueryRequestDTO userQueryRequestDTO);

    /**
     * 是否是管理员
     * @param user
     * @return
     */
    boolean isAdmin(User user);
}
